@extends('layout/admin')

@section('headcss')
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link rel="stylesheet" href="{{ URL::asset('admin/icheck/minimal/red.css')}}">

    <style type="text/css">
        .layui-table-cell{height: 100px;line-height: 100px;}
        #imgadd{width:150px;display: none; padding-left:110px; padding-top:10px;}
        .chongbutd{display: none; padding-left:140px; padding-top:10px;}
        #imgupdate{width:150px;display: none; padding-left:110px; padding-top:10px;}
    </style>
@stop

@section('content')
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
        <fieldset class="layui-elem-field">
            <legend>{{$label}}</legend>

            <input type="hidden" id="hidden_url" value="{{ URL::asset('/img')}}">

            <div class="layui-field-box">
              <hr>
              <div class="layui-btn-group">
                  <button class="layui-btn layui-btn-normal add-tan" add-url="" >
                      <i class="layui-icon">&#xe654;</i>新增
                  </button>
                  <button class="layui-btn layui-refresh">
                      <i class="layui-icon">&#xe9aa;</i>刷新
                  </button>
              </div>
              <hr>
              <table id="nevimsg" lay-filter="datalist"></table>

              <!-- 图片 -->
              <script type="text/html" id="img">
                  <img src="{{ URL::asset('/img')}}/<< d.pictures >>" >
              </script>

              <!-- 操作按钮 -->
              <script type="text/html" id="barDemo">
                  <a class="layui-btn  layui-btn-sm" lay-event="edit">编辑</a>
                  <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a>
              </script>

              <div id="fenye"></div>

            </div>
        </fieldset>
    </div>
  </div>

  <div class="layui-container add-data" style="display: none">
    <div class="layui-row">
        <div class="layui-col-lg12">
            <fieldset class="layui-elem-field">
                <legend>{{$label}}</legend>
                <div class="layui-field-box">
                    <form class="layui-form" >
                        {{ csrf_field() }}
                        <div class="layui-form-item">
                            <label class="layui-form-label">展示位置*</label>
                            <div class="layui-input-inline">
                                <select name="advert_path" lay-verify="">
                                      <option value="">选择展示位置</option>
                                  @foreach($advert_path as $ks => $vs)
                                      <option value="{{$ks}}">{{$vs}}</option>
                                  @endforeach
                                </select>
                            </div>
                            <div class="layui-form-mid layui-word-aux">要选择其他地方 请联系管理员</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-inline">
                            <input type="text" name="titles" required  lay-verify="required" placeholder="请输入导航名称" autocomplete="off" class="layui-input" value = "" lay-verType="tips">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">链接*</label>
                            <div class="layui-input-inline">
                            <input type="text" name="urls" required  lay-verify="required" placeholder="请输入导航链接" autocomplete="off" class="layui-input" value = "" lay-verType="tips">
                            </div>
                        </div>

                        <div class="layui-form-item">
                          <label class="layui-form-label">上传展示图*</label>
                          <button type="button" class="layui-btn layui-btn-normal electpic" id="electpic">选择图片</button>
                          <button type="button" class="layui-btn addpic" id="addpic">开始上传</button>
                          <img id='imgadd' src="">
                          <div class="chongbutd">
                            <button type="button" class="layui-btn layui-btn-danger addpic2" id="addpic2">重新上传</button>
                          </div>
                          <input type="hidden" class="layui-input imgcurl" name="imgurl" id="imgcurl" value="">
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">前台展示</label>
                            <div class="layui-input-block">
                            <input type="checkbox" name="is_show" lay-skin="switch" lay-text="ON|OFF" value="1">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                            <button class="layui-btn " lay-submit lay-filter="addbutton">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
        </div>
    </div>
</div>

  <div class="layui-container update-data" style="display: none">
    <div class="layui-row">
        <div class="layui-col-lg12">
            <fieldset class="layui-elem-field">
                <legend>{{$label}}</legend>
                <div class="layui-field-box">

                    <form class="layui-form" lay-filter="example">
                        {{ csrf_field() }}
                        <input type="hidden" name="id" value="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">展示位置*</label>
                            <div class="layui-input-inline">
                                <select name="advert_path" lay-verify="">
                                      <option value="">选择展示位置</option>
                                  @foreach($advert_path as $ks => $vs)
                                      <option value="{{$ks}}">{{$vs}}</option>
                                  @endforeach
                                </select>
                            </div>
                            <div class="layui-form-mid layui-word-aux">要选择其他地方展示 请联系管理员</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-inline">
                            <input type="text" name="titles" required  lay-verify="required" placeholder="请输入导航名称" autocomplete="off" class="layui-input" value = "" lay-verType="tips">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">链接*</label>
                            <div class="layui-input-inline">
                            <input type="text" name="urls" required  lay-verify="required" placeholder="请输入导航链接" autocomplete="off" class="layui-input" value = "" lay-verType="tips">
                            </div>
                        </div>

                        <div class="layui-form-item">
                          <label class="layui-form-label">上传展示图*</label>
                          <button type="button" class="layui-btn layui-btn-normal electpic" id="electpic">选择图片</button>
                          <button type="button" class="layui-btn addpic" id="addpic">开始上传</button>
                          <img id='imgupdate' src="">
                          <div class="chongbutd">
                            <button type="button" class="layui-btn layui-btn-danger addpic2" id="addpic2">重新上传</button>
                          </div>
                          <input type="hidden" class="layui-input imgcurl" name="imgurl" id="imgcurl" value="">
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                            <button class="layui-btn " lay-submit lay-filter="update-button">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
        </div>
    </div>
</div>

@stop

@section('js')
  <script type="text/javascript" src="{{ URL::asset('admin/icheck/icheck.js')}}"></script>
  <script type="text/javascript" src="{{ URL::asset('admin/javascript/adverts.js')}}"></script>
@stop
